args starts counting from the first word after the class name.args comes fromEvery Java program starts at one method, and the JVM hands it exactly one thing: an array of Strings holding whatever you typed after the class name.
public class Greet { public static void main(String[] args) { // args is created and filled in by the JVM before main() runs System.out.println("You passed " + args.length + " argument(s)"); } }
Compile and run it, then try passing different numbers of words:
Even "3" arrives as the two-character string "3", not the number 3. If you need a number, you convert it yourself — the JVM never guesses your intent.